package com.carskeeper.mapper;


import com.carskeeper.model.body.dtos.BodyUserCountDto;
import com.carskeeper.model.body.dtos.InsertBodyUserDto;
import com.carskeeper.model.body.pojos.BodyUser;
import com.carskeeper.model.body.vo.BodyUserListVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BodyUserMapper {

    /**
     * 查询主体列表
     * @param noList
     * @return
     */
    List<BodyUserCountDto>  findBodyBodyUserByNoList(@Param("noList")List<Integer> noList);

    /**
     * 添加管理员
     * @param dto
     */
    @Insert("insert into body_user values(null,#{realname},#{username},#{password},1,false,#{providerNo},#{phone})")
    void addAdmin(InsertBodyUserDto dto);

    /**
     * 查询用户列表
     * @param id
     * @return
     */
    @Select("select * from body_user where provider_no = #{id}")
    List<BodyUserListVo> findUserList(Long id);

    @Update("update body_user set password = 123456 where id = #{id}")
    void reset(Long id);

    @Update("update body_user set status = #{status} where id = #{id}")
    void lockUser(@Param("id") Long id, @Param("status") Boolean status);

}
